﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.SpcManagement;

namespace Digitalmes.Model.SpcManagement
{
    /// <summary>
    /// SPC分析
    /// </summary>
	[Table("SpcAnalysis")]

    [Display(Name = "_Model.SpcAnalysis")]
    public class SpcAnalysis : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._SpcAnalysis._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._SpcAnalysis._ChartName")]
        [Comment("图表名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ChartName { get; set; }
        [Display(Name = "_Model._SpcAnalysis._UCL")]
        [Comment("上控制限")]
        [Precision(18,3)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? UCL { get; set; }
        [Display(Name = "_Model._SpcAnalysis._CL")]
        [Comment("中心线")]
        [Precision(18,3)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? CL { get; set; }
        [Display(Name = "_Model._SpcAnalysis._LCL")]
        [Comment("下控制限")]
        [Precision(18,3)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? LCL { get; set; }
        [Display(Name = "_Model._SpcAnalysis._USL")]
        [Comment("规格上限")]
        [Precision(18,3)]
        public decimal? USL { get; set; }
        [Display(Name = "_Model._SpcAnalysis._LSL")]
        [Comment("规格下限")]
        [Precision(18,3)]
        public decimal? LSL { get; set; }
        [Display(Name = "_Model._SpcAnalysis._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._SpcAnalysis._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._SpcAnalysis._OpName")]
        [Comment("工序名称")]
        public string OpName { get; set; }
        [Display(Name = "_Model._SpcAnalysis._ChartType")]
        [Comment("控制图样式")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public SpcChartTypeEnum? ChartType { get; set; }
        [Display(Name = "_Model._SpcAnalysis._Code")]
        [Comment("表单编号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Code { get; set; }
        [Display(Name = "_Model._SpcAnalysis._Desc")]
        [Comment("表单描述")]
        public string Desc { get; set; }
        [Display(Name = "_Model._SpcAnalysis._DataName")]
        [Comment("数据名称")]
        public string DataName { get; set; }
        [Display(Name = "_Model._SpcAnalysis._SimpleQty")]
        [Comment("抽样数量")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public int? SimpleQty { get; set; }
        [Display(Name = "_Model._SpcAnalysis._OpId")]
        [Comment("工序")]
        public long? OpId { get; set; }
        [Display(Name = "_Model._SpcAnalysis._Remark")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._SpcAnalysis._DataTag")]
        [Comment("数据Tag")]
        public string DataTag { get; set; }
        [Display(Name = "_Model._SpcAnalysis._SubgroupSize")]
        [Comment("子组大小")]
        public int? SubgroupSize { get; set; }
        [Display(Name = "_Model._SimpleData._Sheet")]
        [InverseProperty("Sheet")]
        public List<SimpleData> SimpleData_Sheet { get; set; }
        [Display(Name = "_Model._SpcAnalysis._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
